package product;

import java.awt.EventQueue;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;

import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JSeparator;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.awt.Color;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

import javax.swing.JLayeredPane;
import javax.swing.border.TitledBorder;
import javax.swing.UIManager;
import javax.swing.border.LineBorder;
import java.awt.SystemColor;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class DeliveryInput extends JInternalFrame {
	DeliveryData dd;//납품정보 data 객체생성
	CompanyData cd;//회사정보의 데이타
	List<Long> al=new ArrayList<Long>();//delivery의 int값이 해쉬맵에서 순차적으로 정렬안되므로 넣어서 정렬시켜주려고
	String filename;//파일이름저장시 필요한 변수
	DecimalFormat ff=new DecimalFormat("#,###");//가격표시지(,)표시 해주려고
	String priceSave="";
	int emCuser=0;//제품검색시 값이없다면 커서가 제자리에 있게하기 위해서
	
	ProductMain4 main;
	private JButton btnNewButton;
	private JTextField search;
	private JTextField itemName;
	private JTextField price;
	private JButton btnSave;
	private JButton btnReset;
	private JTextField count;
	private JLayeredPane layeredPane_1;
	private JTextField comName;
	private JTextField preName;
	private JTextField comNumber;
	private JLayeredPane layeredPane_2;
	private JTextField search2;
	private JButton btnSearch;
	private JLayeredPane layeredPane_3;
	private JTextField totPrice;
	private JLabel lblEmployeeName;
	private JTextField member;
	private JLabel list1;
	private JLabel label_6;
	private JPanel panel;
	private JLayeredPane layeredPane_4;
	private JPanel panel_1;
	private JLabel lblDeliveryInput;
	private JLabel label_7;
	private JLabel label_5;
	private JLabel label_10;
	private JLabel label_11;
	private JLabel label_13;
	private JLabel label_14;
	private JLabel label_2;
	private JLabel label_3;
	private JLabel label_1;
	private JTextField pcode;
	private JButton button;
	private JButton button_1;

	/**
	 * Launch the application.
	 */
//	public static void main(String[] args) {
//		EventQueue.invokeLater(new Runnable() {
//			@Override
//			public void run() {
//				try {
//					DeliveryInput frame = new DeliveryInput();
//					frame.setVisible(true);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//		});
//	}

	/**
	 * Create the frame.
	 */
	public DeliveryInput(ProductMain4 m) {
		super("Delivery Input",false,true,false,true);
		getContentPane().setBackground(Color.WHITE);
		setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
		
		setBounds(100, 100, 420, 592);
		getContentPane().setLayout(null);
		getContentPane().add(getLayeredPane_1_1());
		getContentPane().add(getLayeredPane_2());
		getContentPane().add(getLayeredPane_3());
		getContentPane().add(getLabel_6());
		getContentPane().add(getPanel());
		getContentPane().add(getBtnReset());
		getContentPane().add(getBtnSave());
		getContentPane().add(getLayeredPane_4());
		getContentPane().add(getPanel_1());
		getContentPane().add(getLabel_7_2());
		getContentPane().add(getButton());
		getContentPane().add(getButton_1());
		
		this.main=m;//DB 정보를 가지고있는 ProductMain4를 가지고 온다
		
	}
	
	public boolean check(String a){//수량,단가에 정수만 넣어주기
		try{
			Long.parseLong(a);//뭘넣든 상관없다 리턴값만 내주기위해서,String.Valueof쓰면 문자값 받을시 true,Long.parseLong넣으면  true라는 뜻
			return true;
		}catch(NumberFormatException b){//숫자 아닌경우 제외
			return false;
		}
	}
	
	private JButton getBtnNewButton() {
		if (btnNewButton == null) {
			btnNewButton = new JButton("Search");
			btnNewButton.setForeground(Color.DARK_GRAY);
			btnNewButton.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
			btnNewButton.setBounds(269, 10, 100, 22);
			btnNewButton.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent arg0) {
					
					csSelect();
				}
			});
		}
		return btnNewButton;
	}
	
	private JTextField getSearch() {
		if (search == null) {
			search = new JTextField();
			search.addKeyListener(new KeyAdapter() {
				@Override
				public void keyPressed(KeyEvent ev) {
					
					if(ev.getKeyCode()==KeyEvent.VK_ENTER){
						csSelect();
						search2.requestFocus();
						search2.setText("");
					}	
				}
			});
			search.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent arg0) {
					if(search.getText().equals("회사명/번호")){
						search.setText("");
					}
				}
			});
			search.setText("회사명/번호");
			search.setBounds(15, 10, 242, 22);
			search.setFont(new Font("굴림", Font.PLAIN, 13));
			search.setColumns(10);
		}
		return search;
	}
	private JTextField getItemName() {
		if (itemName == null) {
			itemName = new JTextField();
			itemName.setHorizontalAlignment(SwingConstants.CENTER);
			itemName.setBorder(new LineBorder(new Color(171, 173, 179)));
			itemName.setEnabled(false);
			itemName.setBounds(189, 36, 170, 23);
			itemName.setFont(new Font("굴림", Font.PLAIN, 13));
			itemName.setColumns(10);
		}
		return itemName;
	}
	private JTextField getPrice() {//단가 창
		if (price == null) {
			price = new JTextField();
			price.setHorizontalAlignment(SwingConstants.RIGHT);
			price.setBorder(new LineBorder(new Color(171, 173, 179)));
			price.setEnabled(false);
			price.setBounds(189, 126, 170, 23);
			price.setFont(new Font("굴림", Font.PLAIN, 13));
			price.addKeyListener(new KeyAdapter() {
			});
			price.setColumns(10);
		}
		return price;
	}
	private JButton getBtnSave() {
		if (btnSave == null) {
			btnSave = new JButton("Save");
			btnSave.setForeground(Color.DARK_GRAY);
			btnSave.setFont(new Font("Microsoft JhengHei UI", Font.BOLD, 15));
			btnSave.setBounds(302, 277, 87, 30);
			btnSave.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent arg0) {
					namesave();
				}
			});
		}
		return btnSave;
	}
	private JButton getBtnReset() {
		if (btnReset == null) {
			btnReset = new JButton("ReSet");
			btnReset.setForeground(Color.DARK_GRAY);
			btnReset.setFont(new Font("Microsoft JhengHei UI", Font.BOLD, 15));
			btnReset.setBounds(203, 277, 87, 30);
			btnReset.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent arg0) {
					itemName.setText("");//재품명 초기화
					price.setText("");//단가 초기화
					count.setText("");//수량 초기화
					pcode.setText("");//총금액 초기화
					search.setText("");//검색 초기화
					search2.setText("");
					comName.setText("");//회사명 초기화
					preName.setText("");//대표자명 초기화
					comNumber.setText("");//사업자번호 초기화
					list1.setText("");//초기화
					member.setText("");
					totPrice.setText("");
				}
			});
		}
		return btnReset;
	}
	private JTextField getCount() {
		if (count == null) {
			count = new JTextField();
			count.setHorizontalAlignment(SwingConstants.CENTER);
			count.setBorder(new LineBorder(Color.RED, 2));
			count.setBounds(189, 96, 170, 23);
			count.setFont(new Font("굴림", Font.PLAIN, 13));
			count.addKeyListener(new KeyAdapter() {//수량버튼에 값을 넣을때마다
				@Override
				public void keyReleased(KeyEvent bb) {
					
					
					if((!check(count.getText()))){//수량이 정수가 아닐때
						list1.setText("정수값을 넣어주세요");
					}else{
						long co=Long.parseLong(count.getText());
						list1.setText("수량:"+ff.format(co)+"개");//단가를 라벨1(list1)에 표시
						
						if(price.getText().equals("")){//가격이 비었을때	
						}else{
						
							long pr=Long.parseLong(priceSave);
							long tot=co*pr;//단가와 수량 계산
							
							totPrice.setText(ff.format(tot)+"원");//총금액을 표시해준다
						}
					}	
				}
			});
			count.setColumns(10);
		}
		return count;
	}
	private JLayeredPane getLayeredPane_1_1() {
		if (layeredPane_1 == null) {
			layeredPane_1 = new JLayeredPane();
			layeredPane_1.setOpaque(true);
			layeredPane_1.setBackground(SystemColor.inactiveCaptionBorder);
			layeredPane_1.setBorder(new LineBorder(Color.GRAY, 2));
			layeredPane_1.setBounds(12, 121, 379, 109);
			layeredPane_1.add(getPreName());
			layeredPane_1.add(getComNumber());
			layeredPane_1.add(getLabel_11());
			layeredPane_1.add(getLabel_5());
			layeredPane_1.add(getLabel_10());
			layeredPane_1.add(getComName());
		}
		return layeredPane_1;
	}
	private JTextField getComName() {
		if (comName == null) {
			comName = new JTextField();
			comName.setBorder(new LineBorder(new Color(171, 173, 179)));
			comName.setBounds(189, 42, 173, 25);
			comName.setHorizontalAlignment(SwingConstants.CENTER);
			comName.setFont(new Font("굴림", Font.BOLD, 13));
			comName.setEnabled(false);
			comName.setColumns(10);
		}
		return comName;
	}
	private JTextField getPreName() {
		if (preName == null) {
			preName = new JTextField();
			preName.setBorder(new LineBorder(new Color(171, 173, 179)));
			preName.setHorizontalAlignment(SwingConstants.CENTER);
			preName.setFont(new Font("굴림", Font.BOLD, 13));
			preName.setEnabled(false);
			preName.setColumns(10);
			preName.setBounds(189, 72, 173, 25);
		}
		return preName;
	}
	private JTextField getComNumber() {
		if (comNumber == null) {
			comNumber = new JTextField();
			comNumber.setBorder(new LineBorder(new Color(171, 173, 179)));
			comNumber.setHorizontalAlignment(SwingConstants.CENTER);
			comNumber.setFont(new Font("굴림", Font.BOLD, 13));
			comNumber.setEnabled(false);
			comNumber.setColumns(10);
			comNumber.setBounds(189, 12, 173, 24);
		}
		return comNumber;
	}
	private JLayeredPane getLayeredPane_2() {
		if (layeredPane_2 == null) {
			layeredPane_2 = new JLayeredPane();
			layeredPane_2.setOpaque(true);
			layeredPane_2.setBackground(SystemColor.activeCaption);
			layeredPane_2.setBorder(new LineBorder(SystemColor.activeCaption, 2));
			layeredPane_2.setBounds(12, 313, 381, 41);
			layeredPane_2.setLayout(null);
			layeredPane_2.add(getSearch2());
			layeredPane_2.add(getBtnSearch());
		}
		return layeredPane_2;
	}
	private JTextField getSearch2() {
		if (search2 == null) {
			search2 = new JTextField();
			search2.addKeyListener(new KeyAdapter() {
				@Override
				public void keyPressed(KeyEvent ev) {
					if(ev.getKeyCode()==KeyEvent.VK_ENTER){
						cdSelect();
						if(emCuser==1){//커서가 아래로 내려감
							member.requestFocus();
						}
					}
				}
			});
			search2.addMouseListener(new MouseAdapter() {
				@Override
				public void mouseClicked(MouseEvent arg0) {
					if(search2.getText().equals("제품명/번호")){
						search2.setText("");
					}
				}
			});
			search2.setBounds(15, 9, 251, 21);
			search2.setText("제품명/번호");
			search2.setFont(new Font("굴림", Font.PLAIN, 13));
			search2.setColumns(10);
		}
		return search2;
	}
	private JButton getBtnSearch() {
		if (btnSearch == null) {
			btnSearch = new JButton("Search");
			btnSearch.setBounds(273, 8, 100, 22);
			btnSearch.setForeground(Color.DARK_GRAY);
			btnSearch.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
			btnSearch.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					cdSelect();
				}
			});
		}
		return btnSearch;
	}
	private JLayeredPane getLayeredPane_3() {
		if (layeredPane_3 == null) {
			layeredPane_3 = new JLayeredPane();
			layeredPane_3.setBackground(SystemColor.inactiveCaptionBorder);
			layeredPane_3.setOpaque(true);
			layeredPane_3.setBorder(new LineBorder(Color.GRAY, 2));
			layeredPane_3.setBounds(12, 362, 378, 189);
			layeredPane_3.add(getItemName());
			layeredPane_3.add(getPrice());
			layeredPane_3.add(getCount());
			layeredPane_3.add(getTotPrice());
			layeredPane_3.add(getLabel_7_1());
			layeredPane_3.add(getTextField_4());
			layeredPane_3.add(getLabel_13());
			layeredPane_3.add(getLabel_14());
			layeredPane_3.add(getLabel_2_1());
			layeredPane_3.add(getLabel_3_1());
			layeredPane_3.add(getLabel_1_1());
			layeredPane_3.add(getPcode());
		}
		return layeredPane_3;
	}
	private JTextField getTotPrice() {
		if (totPrice == null) {
			totPrice = new JTextField();
			totPrice.setBackground(SystemColor.info);
			totPrice.setBorder(new LineBorder(new Color(171, 173, 179)));
			totPrice.setHorizontalAlignment(SwingConstants.RIGHT);
			totPrice.setFont(new Font("굴림", Font.PLAIN, 13));
			totPrice.setEnabled(false);
			totPrice.setColumns(10);
			totPrice.setBounds(189, 156, 170, 23);
		}
		return totPrice;
	}
	private JLabel getLabel_7_1() {
		if (lblEmployeeName == null) {
			lblEmployeeName = new JLabel("Employee Name");
			lblEmployeeName.setFont(new Font("Microsoft JhengHei UI", Font.PLAIN, 13));
			lblEmployeeName.setHorizontalAlignment(SwingConstants.LEFT);
			lblEmployeeName.setBounds(29, 66, 110, 20);
		}
		return lblEmployeeName;
	}
	private JTextField getTextField_4() {
		if (member == null) {
			member = new JTextField();
			member.setHorizontalAlignment(SwingConstants.CENTER);
			member.setBorder(new LineBorder(new Color(255, 0, 0), 2));
			member.setFont(new Font("굴림", Font.PLAIN, 13));
			member.setColumns(10);
			member.setBounds(189, 66, 170, 23);
		}
		return member;
	}
	

	private JLabel getLabel_6_1() {
		if (list1 == null) {
			list1 = new JLabel("상태정보");
			list1.setFont(new Font("굴림", Font.PLAIN, 13));
			list1.setBounds(12, 7, 355, 23);
			list1.setOpaque(true);
			list1.setHorizontalAlignment(SwingConstants.CENTER);
			list1.setBackground(Color.LIGHT_GRAY);
		}
		return list1;
	}


	public void csSelect(){//거래처 조회
		String s=search.getText();
		String sql="select * from customer where num=? or name=?";
		
		try{
			
//			OracleJdbc o = new OracleJdbc();
//			main.conn = o.conn;
			
			PreparedStatement ptmt=main.conn.prepareStatement(sql);//키값으로 가져오기
			ptmt.setString(1, s);
			ptmt.setString(2, s);
			
			ResultSet rs=ptmt.executeQuery();
			if(rs.next()){
				comName.setText(rs.getString("NAME"));//회사명출력
				comNumber.setText(rs.getString("NUM"));//사업자번호 출력
				preName.setText(rs.getString("CEO"));//대표자명 출력
				list1.setText("조회가 완료되었습니다");
			}
			else{ //회사정보가 없다면 아래와 같은 라벨 출력
				list1.setText("회사 정보가 없습니다");
				comName.setText("");//회사명 초기화
				preName.setText("");//대표자명 초기화
				comNumber.setText("");//사업자번호 초기화
			}
			
			rs.close();
			ptmt.close();
//			main.conn.close();
	
		}catch(Exception ex){
			
		}
		
	}
	
	public void cdSelect(){//납품정보 조회
		String s=search2.getText();
		String sql="select pro_code, pro_nm, pro_price from code where pro_code=? or pro_nm=?";

		try{
//			OracleJdbc o = new OracleJdbc();
//			main.conn = o.conn;
			
			PreparedStatement ptmt=main.conn.prepareStatement(sql);//키값으로 가져오기
			ptmt.setString(1, s);
			ptmt.setString(2, s);
			
			ResultSet rs=ptmt.executeQuery();
			if(rs.next()){
				
				pcode.setText(rs.getString(1));//제품코드
				itemName.setText(rs.getString(2));//제품명
				priceSave=rs.getString(3);
				price.setText(ff.format(Integer.parseInt(priceSave))+" 원");//단가
				
				list1.setText("조회가 완료되었습니다");
				emCuser=1;//커서가 아래로내려감
			}
			else{ //회사정보가 없다면 아래와 같은 라벨 출력
				list1.setText("찾는 상품이 없습니다");
				search2.setText("");
				search2.requestFocus();
			}
			
			rs.close();
			ptmt.close();
//			main.conn.close();
	
		}catch(Exception ex){
		}
		
	}
	
	
	public void dbSave(String k){
		try{
			
//			OracleJdbc o = new OracleJdbc();
//			main.conn = o.conn;
			
			String nu="select max(num) from delivery";//db에 저장된 nu값중 마지막 값을 가져온다. //납품번호
			String co=count.getText();//수량
			String nal="to_char(sysdate, 'yyyy-mm-dd')";//날짜
			String cust=comNumber.getText();//사업자 번호
			String pc=pcode.getText();//제품코드
			
			PreparedStatement ptmt=main.conn.prepareStatement(nu);//num값
			ResultSet rs=ptmt.executeQuery();
			if(rs.next()){
				nu=rs.getString(1);
			}
			
			String sa="insert into delivery values("+((Integer.parseInt(nu))+1)+", "+Integer.parseInt(co)+", "+nal+", '"+cust+"', '"+pc+"', '"+k+"')";
			PreparedStatement ptmt3=main.conn.prepareStatement(sa);//deliver테이블에 추가한다
		
			ResultSet rs3=ptmt3.executeQuery();
			if(rs3.next()){
				JOptionPane.showMessageDialog(null, "저장되었습니다");
				list1.setText("저장되었습니다");
			}			
			rs.close();
			ptmt.close();
//			main.conn.close();
	
		}catch(Exception ex){
			ex.printStackTrace();
		}
}
	//사원이름 저장시
	public void namesave(){
		
		int count=0;
		String rrr="";
		String s=member.getText();
		
		//String sql="select irum from memberdata where irum=? or memberid=?";
		String sql="select memberid from memberdata where irum=? or memberid=?";
		try{
//			OracleJdbc o = new OracleJdbc();
//			main.conn = o.conn;
			
			PreparedStatement ptmt=main.conn.prepareStatement(sql);//키값으로 가져오기
			ptmt.setString(1, s);
			ptmt.setString(2, s);
			
			ResultSet rs=ptmt.executeQuery();
			
				while(rs.next()){
					if(rs.getString(1)!=null || rs.getString(2)!=null){//결과값이 2개이상 나올시
						rrr=rs.getString(1);
						count++;
					}	
				}
				if(count>1){//동
					JOptionPane.showMessageDialog(null, "동일한 이름이 많습니다 사원번호를 입력해주세요");
				}
				else if(count==1){
					dbSave(rrr);
				}
				else if(count==0){ //사원이름정보가 없다면 아래와 같은 라벨 출력
					JOptionPane.showMessageDialog(null, "사원 정보가 없습니다");
					list1.setText("사원이름 다시 입력해주세요");
					member.setText("");//사원명 초기화
				}
				count=0;
			
			rs.close();
			ptmt.close();
//			main.conn.close();
			
		}catch(Exception ex){
			
		}
		
	}
	private JLabel getLabel_6() {
		if (label_6 == null) {
			label_6 = new JLabel("Delivery Information");
			label_6.setForeground(Color.DARK_GRAY);
			label_6.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
			label_6.setBounds(12, 282, 171, 30);
		}
		return label_6;
	}
	private JPanel getPanel() {
		if (panel == null) {
			panel = new JPanel();
			panel.setLayout(null);
			panel.setBounds(12, 237, 379, 37);
			panel.add(getLabel_6_1());
		}
		return panel;
	}
	private JLayeredPane getLayeredPane_4() {
		if (layeredPane_4 == null) {
			layeredPane_4 = new JLayeredPane();
			layeredPane_4.setLayout(null);
			layeredPane_4.setOpaque(true);
			layeredPane_4.setBorder(new LineBorder(SystemColor.activeCaption, 2));
			layeredPane_4.setBackground(SystemColor.activeCaption);
			layeredPane_4.setBounds(12, 76, 379, 40);
			layeredPane_4.add(getSearch());
			layeredPane_4.add(getBtnNewButton());
		}
		return layeredPane_4;
	}
	private JPanel getPanel_1() {
		if (panel_1 == null) {
			panel_1 = new JPanel();
			panel_1.setLayout(null);
			panel_1.setBorder(new LineBorder(Color.GRAY, 2));
			panel_1.setBounds(36, 2, 315, 46);
			panel_1.add(getLabel_5_1());
		}
		return panel_1;
	}
	private JLabel getLabel_5_1() {
		if (lblDeliveryInput == null) {
			lblDeliveryInput = new JLabel("Delivery Input");
			lblDeliveryInput.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 23));
			lblDeliveryInput.setBounds(90, 2, 164, 36);
		}
		return lblDeliveryInput;
	}
	private JLabel getLabel_7_2() {
		if (label_7 == null) {
			label_7 = new JLabel("Customer Information");
			label_7.setForeground(Color.DARK_GRAY);
			label_7.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 15));
			label_7.setBounds(12, 47, 170, 30);
		}
		return label_7;
	}
	private JLabel getLabel_5() {
		if (label_5 == null) {
			label_5 = new JLabel("Registration Number ");
			label_5.setBounds(24, 9, 170, 30);
			label_5.setPreferredSize(new Dimension(70, 20));
			label_5.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
		}
		return label_5;
	}
	private JLabel getLabel_10() {
		if (label_10 == null) {
			label_10 = new JLabel("Legal Business Name");
			label_10.setBounds(24, 39, 170, 30);
			label_10.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
		}
		return label_10;
	}
	private JLabel getLabel_11() {
		if (label_11 == null) {
			label_11 = new JLabel("ChairMan");
			label_11.setBounds(24, 69, 170, 30);
			label_11.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
		}
		return label_11;
	}
	private JLabel getLabel_13() {
		if (label_13 == null) {
			label_13 = new JLabel("Product Name");
			label_13.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
			label_13.setBounds(29, 36, 110, 20);
		}
		return label_13;
	}
	private JLabel getLabel_14() {
		if (label_14 == null) {
			label_14 = new JLabel("Quantity");
			label_14.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
			label_14.setBounds(29, 96, 92, 20);
		}
		return label_14;
	}
	private JLabel getLabel_2_1() {
		if (label_2 == null) {
			label_2 = new JLabel("Unit Price");
			label_2.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
			label_2.setBounds(29, 126, 105, 20);
		}
		return label_2;
	}
	private JLabel getLabel_3_1() {
		if (label_3 == null) {
			label_3 = new JLabel("Total Amount");
			label_3.setBackground(new Color(255, 192, 203));
			label_3.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
			label_3.setBounds(29, 156, 105, 20);
		}
		return label_3;
	}
	private JLabel getLabel_1_1() {
		if (label_1 == null) {
			label_1 = new JLabel("Product Code");
			label_1.setFont(new Font("Microsoft YaHei UI", Font.PLAIN, 13));
			label_1.setBounds(29, 6, 110, 20);
		}
		return label_1;
	}
	private JTextField getPcode() {
		if (pcode == null) {
			pcode = new JTextField();
			pcode.setHorizontalAlignment(SwingConstants.CENTER);
			pcode.setBorder(new LineBorder(new Color(171, 173, 179)));
			pcode.setFont(new Font("굴림", Font.BOLD, 13));
			pcode.setEnabled(false);
			pcode.setColumns(10);
			pcode.setBounds(189, 6, 170, 23);
		}
		return pcode;
	}
	private JButton getButton() {
		if (button == null) {
			button = new JButton("거래처정보");
			button.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					main.openList();
					main.tList.getComboBox_1().setSelectedItem("거래처");
					main.tList.searchData();
				}
			});
			button.setForeground(Color.DARK_GRAY);
			button.setFont(new Font("굴림", Font.PLAIN, 13));
			button.setBounds(182, 50, 105, 22);
		}
		return button;
	}
	private JButton getButton_1() {
		if (button_1 == null) {
			button_1 = new JButton("제품정보");
			button_1.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					main.openList();
					main.tList.getComboBox_1().setSelectedItem("생산");
					main.tList.searchData();
				}
			});
			button_1.setForeground(Color.DARK_GRAY);
			button_1.setFont(new Font("굴림", Font.PLAIN, 13));
			button_1.setBounds(292, 50, 98, 22);
		}
		return button_1;
	}
}
